package com.lkd.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lkd.entity.SkuClass;
import com.lkd.mapper.SkuClassMapper;
import com.lkd.service.SkuClassService;
import com.lkd.vo.PageBean;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 商品类别表 服务实现类
 * </p>
 *
 * @author 聂德祥
 * @since 2024-08-17
 */
@Service
public class SkuClassServiceImpl extends ServiceImpl<SkuClassMapper, SkuClass> implements SkuClassService {

    @Override
    public PageBean<SkuClass> findByPage(String className, Integer pageIndex, Integer pageSize) {
        Page<SkuClass> skuClassPage = new Page<>(pageIndex, pageSize);
        LambdaQueryWrapper<SkuClass> wrapper = new LambdaQueryWrapper<SkuClass>().like(className != null && !className.equals(""), SkuClass::getClassName, className);
       skuClassPage =  getBaseMapper().selectPage(skuClassPage,wrapper);

        return new PageBean<SkuClass>(skuClassPage);
    }
}
